package com.springdi.ui;

import com.springdi.dao.IAccountDao;
import com.springdi.service.IAccountService;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import java.util.Date;

public class client {

    public static void main(String[] args) {
        //1获取核心容器对象
        ApplicationContext ac=new ClassPathXmlApplicationContext("beandi.xml");
        //获取的object类型，然后通过接口对其进行强转
        //IAccountService ias=(IAccountService)ac.getBean("accounts");
        IAccountService ias=ac.getBean("accounts2",IAccountService.class);
        ias.saveAccount();
        //传入字节码文件的方式，不需要强转。
        IAccountDao iad=ac.getBean("accoutd",IAccountDao.class);
        iad.saveAccountDao();
    }
}
